import {
  defineConfig,
  presetIcons,
  transformerDirectives,
  transformerVariantGroup,
} from 'unocss';

import { presetUni } from '@uni-helper/unocss-preset-uni';

export default defineConfig({
  presets: [
    presetUni(),
    presetIcons({
      scale: 1.2,
      warn: true,
      extraProperties: {
        'display': 'inline-block',
        'vertical-align': 'middle',
      },
    }),
  ],
  rules: [
    [/^bd-(#*\w+)$/, ([_, color]) => ({ border: `1px solid ${color}` })],
    [/^bd-(\d+)$/, ([_, d]) => ({ 'border-radius': `${Number(d) * 2}rpx` })],
    ['box-sha', { 'box-shadow': '0px 2px 12px rgba(0, 0, 0, 0.0980392156862745)' }],
  ],
  shortcuts: {
    'card-content': 'bg-white p4',
    'card': 'flex justify-between items-center card-content',
    'wrap': 'card box-sha',
  },
  transformers: [
    transformerDirectives(),
    transformerVariantGroup(),
  ],
});
